import Vue from 'vue'
import Router from 'vue-router'

import index from '@/components/index'
import news from '@/components/news'
import KJ from '@/components/KJ'
import recreation from '@/components/recreation'
import health from '@/components/health'
import sports from '@/components/sports'
import money from '@/components/money'
import army from '@/components/army'
import internet from '@/components/internet'
import userinfoindex from '@/components/userinfoindex'
import spaceinfo from '@/components/spaceinfo'
import changeinfo from '@/components/changeinfo'
import changepic from '@/components/changepic'
import newsss from '@/components/newsss'
import newsList from '@/components/newsList'
import login from '@/components/login'
import Reg from '@/components/Reg'
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error => error)
}

Vue.use(Router)
export default new Router({
  routes: [
    {
      path: '/',
      name: 'login',
      component: login,
    },
    {
      path: '/index',
      name: 'index',
      component: index,
    },
    {
      path: '/news', name: 'news', component: news
    },
    { path: '/KJ', name: 'KJ', component: KJ },
    { path: '/recreation', name: 'recreation', component: recreation },
    { path: '/health', name: 'health', component: health },
    { path: '/sports', name: 'sports', component: sports },
    { path: '/money', name: 'money', component: money },
    { path: '/army', name: 'army', component: army },
    { path: '/internet', name: 'internet', component: internet },
    { path: '/newsss/:id', name: 'newsss', component: newsss },
    { path: '/newsList/:id', name: 'newsList', component: newsList },
    {
      path: '/userinfoindex',
      name: 'userinfoindex',
      component: userinfoindex,
      children: [
        {path: '/changeinfo',name: 'changeinfo', component: changeinfo},
        {path: '/changepic',name: 'changeinfo', component: changepic},
        {path: '/spaceinfo',name: 'spaceinfo', component: spaceinfo},
    ]
    },
    {
      path:'/Reg',
      name:'Reg',
      component:Reg,
    },
  ]
})
